package com.swak.frame.hystrix.event;

import java.lang.reflect.Method;

import com.swak.frame.hystrix.annotation.SwakHystrix;

public class HystrixEventInfo {

    private Method method;

    private Object target;

    private Object[] args;

    private SwakHystrix marsHystrix;

    private String fallbackMethod;

    public Method getMethod() {
        return method;
    }

    public void setMethod(Method method) {
        this.method = method;
    }

    public Object getTarget() {
        return target;
    }

    public void setTarget(Object target) {
        this.target = target;
    }

    public Object[] getArgs() {
        return args;
    }

    public void setArgs(Object[] args) {
        this.args = args;
    }

    public SwakHystrix getMarsHystrix() {
        return marsHystrix;
    }

    public void setMarsHystrix(SwakHystrix marsHystrix) {
        this.marsHystrix = marsHystrix;
    }

    public String getFallbackMethod() {
        return fallbackMethod;
    }

    public void setFallbackMethod(String fallbackMethod) {
        this.fallbackMethod = fallbackMethod;
    }

    public static class Builder {
        private Method method;
        private Object target;
        private Object[] args;
        private SwakHystrix marsHystrix;
        private String fallbackMethod;

        public Builder method(Method method) {
            this.method = method;
            return this;
        }

        public Builder target(Object target) {
            this.target = target;
            return this;
        }

        public Builder args(Object[] args) {
            this.args = args;
            return this;
        }

        public Builder marsHystrix(SwakHystrix marsHystrix) {
            this.marsHystrix = marsHystrix;
            return this;
        }

        public Builder fallbackMethod(String fallbackMethod) {
            this.fallbackMethod = fallbackMethod;
            return this;
        }

        public HystrixEventInfo build() {
            return new HystrixEventInfo(this);
        }
    }

    private HystrixEventInfo(Builder builder) {
        this.method = builder.method;
        this.target = builder.target;
        this.args = builder.args;
        this.marsHystrix = builder.marsHystrix;
        this.fallbackMethod = builder.fallbackMethod;
    }
}
